package com.wzy.userservice.controller;

import com.wzy.orderapi.feignclient.OrderFeignClient;
import com.wzy.orderapi.model.dto.OrderDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    @PostMapping("saverOrder")
    public boolean saveOrder(@RequestBody OrderDto orderDto){
        return orderFeignClient.saveOrder(orderDto);
    }

    @GetMapping("getAllOrder")
    public Collection <OrderDto> getAllOrder(){
        return orderFeignClient.findAll();
    }
}
